import Vue from "vue";
import Vuex from "vuex";
import homeStore from './home'
import cartStore from './cart'
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    searchChecked:true,
    searchname:"",
    searchList:[],
    Navflag: 'bbb'
  },
  mutations: {
    changesearch(state,flag){
      state.searchChecked = flag
    },
    addsearchList(state,list){
      state.searchList = list
    },
    changeFlag(state, flag) {
      state.Navflag = flag
    },
    searchname(state,name){
      state.searchname = name
    }
  },
  actions: {
    changeSearch({commit},flag){
      commit('changesearch',flag)
    },
    addSearchList({commit},list){
      commit('addsearchList',list)
    },
    changeNavFlag({ commit }, flag) {
      commit('changeFlag', flag)
    },
    searchName({commit},name){
      commit("searchname",name)
    }
  },
  modules: {
    homeStore,
    cartStore
  },
  getters:{
    Navflag: state => state.Navflag
  }
});
